home *** CD-ROM | disk | FTP | other *** search
- Path: keats.ugrad.cs.ubc.ca!not-for-mail
- From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
- Newsgroups: comp.lang.c
- Subject: Re: calloc help needed
- Date: 15 Feb 1996 08:20:27 -0800
- Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
- Message-ID: <4fvmgbINNbp0@keats.ugrad.cs.ubc.ca>
- References: <1996Feb15.125431.7751@leeds.ac.uk>
- NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
-
- In article <1996Feb15.125431.7751@leeds.ac.uk>,
- A M Casey <csyamc@scs.leeds.ac.uk> wrote:
- >I'm trying to allocate enough memory for an array of strings, defined as
- >char * MyArray[20].
- >the only manual entry I have for calloc says that it needs two values, the
- >number of elements, and the size of each, but how do I actually use it?
- >
- >MyArray = calloc(20,50);
-
- This is gives you much more space than you need for the array. A character's
- size is not 50!
-
- >doesnt work, as far as I can tell calloc returns an int.
-
- It is probably "implicitly defined" to return an int, because you lack a
- declaration. Try including the "malloc.h" header file.
- --
-
-